home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / pine / cmplhelp.cmd < prev    next >
OS/2 REXX Batch file  |  1996-03-14  |  1KB  |  60 lines

  1. /* rexx */
  2. /* $Id: cmplhelp.cmd,v 4.1 1996/03/14 23:39:13 mikes Exp $
  3. /*
  4.  * cmplhelp.sh -- This script take the pine.help file and turns it into
  5.  * a .c file defining lots of strings
  6.  */
  7.  
  8. parse arg infile c_file h_file
  9.  
  10. in_text=0
  11. count=0;
  12. crlf=d2c(13)||d2c(10)
  13.  
  14. call stream infile, 'C', 'open read'
  15. call stream c_file, 'C', 'open write'
  16. call stream h_file, 'C', 'open write'
  17.  
  18. call lineout c_file, '#include <stdlib.h>'||crlf||crlf
  19.  
  20.  
  21. do while lines(infile)
  22.   line=linein(infile)
  23. /*SAY 'read: "'line'"'*/
  24.   select
  25.     when substr(line,1,4) = '====' then do
  26.       if in_text then 
  27.         call lineout c_file, 'NULL'||crlf||'};'||crlf
  28.       parse var line prefix string suffix
  29.       call lineout c_file, 'char *'||string||'[] = {'
  30.       call lineout h_file, 'extern char *'||string||'[];'
  31.       count = count + 1
  32.       texts.count = string
  33.       in_text = 1
  34.       end
  35.     when line = '' then do
  36.       if in_text then
  37.         call lineout c_file, '" ",'
  38.       end
  39.     otherwise do
  40.       if in_text then
  41.         call lineout c_file, '"'||line||'",'
  42.       end
  43.     end
  44.   end
  45.  
  46. call stream infile, 'C', 'close'
  47.  
  48. if in_text then
  49.   call lineout c_file, 'NULL'||crlf||'};'||crlf
  50. call lineout c_file, 'char **h_texts[] = {'
  51. call lineout h_file, crlf||'extern char **h_texts[];'||crlf
  52. do i=1 to count
  53.   call lineout c_file, texts.i||','
  54.   end
  55. call lineout c_file, 'NULL'||crlf||'};'||crlf
  56.  
  57. call stream c_file, 'C', 'close'
  58. call stream h_file, 'C', 'close'
  59.  
  60.